<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>个人信息</title>
<link type="text/css" rel="stylesheet" href="css/jquery-ui.min.css" />
<link type="text/css" rel="stylesheet" href="css/jquery-ui.theme.min.css" />
<link type="text/css" rel="stylesheet" href="css/styleA.css" />
<link type="text/css" rel="stylesheet" href="css/centerA.css" />
<link rel="stylesheet" type="text/css" href="css/jedateA.css"/>

<script type="text/javascript" src="js/jquery-1.11.2.min.js"></script><!--jquery-1.7.2.min  1.11.2-->
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery.cookieA.js"></script>
<script type="text/javascript" src="js/ajaxfileuploadA.js"></script>
<script type="text/javascript" src="js/jquery.formA.js"></script>

<script type="text/javascript" src="js/jquery.md5A.js"></script>
<script type="text/javascript" src="js/jquery.jsonpA.js"></script>

<script type="text/javascript" src="js/pupil-ajaxA.js"></script>
<script type="text/javascript" src="js/bA.js"></script>
<script type="text/javascript" src="js/styleA.js"></script>
<script type="text/javascript" src="js/PCASClassA.js" charset="gb2312"></script>
<script type="text/javascript" src="js/jeDateA.min.js"></script>
</head> 
<body>
	<div class="public-top min-cen">
    	<div class="center logo"></div>
        <a href="#">注销</a>
    </div>
    <div class="content center public">
   		<div class="menu">
        	<a class="menu-li active" href="javascript:;">
            	<span class="menu-title">个人信息</span>
                <span class="menu-min-title">Personal Information</span>
            </a>
            <a class="menu-li" href="javascript:;">
            	<span class="menu-title">咨询管理</span>
                <span class="menu-min-title">Consulting Management</span>
            </a>
            <a class="menu-li" href="javascript:;">
            	<span class="menu-title">预约管理</span>
                <span class="menu-min-title">Booking Management</span>
            </a>
            <a class="menu-li" href="javascript:;">
            	<span class="menu-title">收入记录</span>
                <span class="menu-min-title">Income Record</span>
            </a>
            <a class="menu-li" href="javascript:;">
            	<span class="menu-title">提现记录</span>
                <span class="menu-min-title">Present Record</span>
            </a>
        </div>
        <div class="puclic-right">
        	<div class="center-top" id="center_info">
            	<a class="active" href="javascript:;">
                	<span class="title">基本资料</span>
                	<span class="min-title">Basic Information</span>
                </a>
                <a href="javascript:;">
                	<span class="title">账户信息</span>
                	<span class="min-title">Account Information</span>
                </a>
                <a href="javascript:;">
                	<span class="title">资质认证</span>
                	<span class="min-title">Qualification Certification</span>
                </a>
                <a href="javascript:;">
                	<span class="title">详细情况</span>
                	<span class="min-title">Detailed Circumstances</span>
                </a>
            </div>
			<!--基本资料-->
        	<div class="center-frame" id= "personInfo_0">
				<form id= "form_personInfo" enctype="multipart/form-data" method="post">
				<input  type="hidden" id="expertId" name="expertId" value="" />
            	<div class="center-box">
                    <div class="register-left">
                        <div class="register-li">
                            <label class="register-label">姓名:<span>*</span></label>
                            <input class="register-input" type="text" id="realName" name="realName" value="" />
                        </div>
                        <div class="register-li">
                            <label class="register-label">性别:<span>*</span></label>
                            <label class="register-label-box">
                                <input class="register-radio" type="radio" name="gender" value="0" />
                                先生
                            </label>
                            <label class="register-label-box">
                                <input class="register-radio" type="radio" name="gender" value="1" />
                                女士
                            </label>
                        </div>
                        <div class="register-li">
                            <label class="register-label">出生日期:</label>
							<input type="text"  class="register-input" id="birthDay" name="birthDay"/>
							<!--<input type="text"  class="register-input ui-datepicker" id="birthDay" name="birthDay" placeholder="请选择日期.."/><!-- birthDay  -->
                          <!--  <select class="register-select">
								<option value="1970">1970</option>
								<option value="1980">1971</option>
								<option value="1980">1972</option>
								<option value="1980">1973</option>
								<option value="1980">1974</option>
								<option value="1980">1975</option>
								<option value="1980">1976</option>
								<option value="1980">1977</option>
								<option value="1980">1978</option>
								<option value="1980">1979</option>
								<option value="1980">1980</option>
                                <option value="1980">1981</option>
								<option value="1980">1982</option>
								<option value="1980">1983</option>
								<option value="1980">1984</option>
								<option value="1980">1985</option>
								<option value="1980">1986</option>
								<option value="1980">1987</option>
								<option value="1980">1988</option>
								<option value="1980">1989</option>
								<option value="1980">1990</option>
                            </select>
                            <span class="register-select-span">年</span>
                            <select class="register-select">
								<option value="1">1</option>
								<option value="2">2</option>
								<option value="3">3</option>
								<option value="4">4</option>
								<option value="5">5</option>
								<option value="6">6</option>
								<option value="7">7</option>
								<option value="8">8</option>
								<option value="9">9</option>
								<option value="10">10</option>
                                <option value="11">11</option>
								<option value="12">12</option>
                            </select>
                            <span class="register-select-span">月</span>
                            <select class="register-select">
								<option value="1">1</option>
								<option value="2">2</option>
								<option value="3">3</option>
								<option value="4">4</option>
								<option value="5">5</option>
								<option value="6">6</option>
								<option value="7">7</option>
								<option value="8">8</option>
								<option value="9">9</option>
								<option value="10">10</option>
								<option value="11">11</option>
								<option value="12">12</option>
								<option value="13">13</option>
								<option value="14">14</option>
								<option value="15">15</option>
								<option value="16">16</option>
								<option value="17">17</option>
								<option value="18">18</option>
								<option value="19">19</option>
								<option value="21">21</option>
								<option value="22">22</option>
								<option value="23">23</option>
								<option value="24">24</option>
								<option value="25">25</option>
								<option value="26">26</option>
								<option value="27">27</option>
								<option value="28">28</option>
								<option value="29">29</option> 
                                <option value="30">30</option>
								<option value="31">31</option>
                            </select>
                            <span class="register-select-span">日</span>-->
                        </div>
                        <div class="register-li">
                            <label class="register-label">身份证号码:<span>*</span></label>
                            <input class="register-input" type="text" name="ID"  id="ID" value="" />
                        </div>
                        <div class="register-li">
                            <label class="register-label">学历:</label>
                            <select class="register-select" id= "education"  name = "education"  style="width:100px;">
								<option value="未设置">未设置</option>
								<option value="博士研究生">博士研究生</option>
                                <option value="硕士研究生">硕士研究生</option>
								<option value="本科">本科</option>
								<option value="专科">专科</option>
								<option value="其他">其他</option>
                            </select>
                            <span class="register-select-span">婚恋状态</span>
                            <select class="register-select" id= "marriage" name = "marriage" style="width:105px;">
                                <option value="未设置">未设置</option>
                                <option value="已婚">已婚</option>
								<option value="未婚">未婚</option>
								<option value="离异">离异</option>
                            </select>
                        </div>
                        <div class="register-li">
                            <label class="register-label">目前所在地:<span>*</span></label>
                            <!--<select class="register-select" id= "province"  name="province" style="width:90px;">
                                <option value=""></option>
                            </select>--> 
                            <!--<span class="register-select-span">省/市</span>-->
							<!--<input class="register-input" type="text" name="province"  id="province" value="" />-->
							<select class="register-input" name="province" id="province" style="width:118px;"></select>
                           <!-- <select class="register-select"  id= "city" name ="city" style="width:85px;">
                                <option value=""></option>
                            </select> -->
                            <!--<span class="register-select-span">市/地区</span>-->
                            <select  class="register-input" id= "" name="city" style="width:153px;"></select><br>
							 <!--<input class="register-input" type="text" name="city"  id="city" value="" />-->
                        </div>
                        <div class="register-li">
                            <label class="register-label">专业资质:<span>*</span></label>
                            <select class="register-select"  id = "position" name = "position" style="width:272px;">
                                <option value="国家三级心理咨询师">国家三级心理咨询师</option>
                                <option value="国家二级心理咨询师">国家二级心理咨询师</option>
                            </select>
                        </div>
                        <div class="register-li">
                            <label class="register-label">QQ:<span>*</span></label>
                            <input class="register-input" type="text" name="qqNumber" id ="qqNumber" value="" />
                        </div>
                        <div class="register-li">
                            <label class="register-label">邮箱地址:<span>*</span></label>
                            <input class="register-input" type="text" name="eMail" id="eMail" value="" />
                        </div>
                    </div>
                    <div class="register-left">
                        <span class="register-pic-title">个人照片</span>
                        <span class="register-pic-img"><img src="images/admin/pic.jpg" style="width:100%;height:100%;" alt="" name="portrait" id="portrait"/></span>
                        <div class="register-pic-box">
                            <div class="register-file-val"></div>
                            <div class="register-file-but">浏览</div>
                            <input class="register-file"  id ="portraitPic"  name = "portraitPic" type="file" />
                        </div>
                        <div class="register-pic-box">
                            <span class="register-pic-prompt">格式要求：jpg、png</span>
                            <span class="register-pic-prompt">尺寸要求：200*250px</span>
                        </div>
                        <div class="register-pic-box">
                            <button class="register-pic-submit" onclick="javascript:uploadImg('portraitPic',this);">上传</button>
                        </div>
                    </div>
                </div>    
                <div class="register-li">
                    <label class="register-label">个性签名:<span>*</span></label>
                    <textarea class="register-textarea" name="slogan" id="slogan"></textarea>
                </div>
                <div class="register-li">
                    <label class="register-label">服务时间:<span>*</span></label>
                    <input class="register-input register-input-time" type="text" name="timeUnit"  id ="timeUnit" value="" />
                    <span class="register-input-lable">分钟</span>
                </div>
                <div class="register-li">
                    <label class="register-label">心理咨询费:<span>*</span></label>
                    <span class="register-input-lable" style="width:70px;">语音咨询</span>
                    <input class="register-input register-input-price" type="text" name="callPriceN"id="callPriceN" value="" />
                    <span class="register-input-lable">元/单位时间<span class="prompt">（无此服务填0）</span></span>
                </div>
                <div class="register-li">
                    <label class="register-label">&nbsp;</label>
                    <span class="register-input-lable" style="width:70px;">文字咨询</span>
                    <input class="register-input register-input-price" type="text" name="textPriceN" id="textPriceN" value="" />
                    <span class="register-input-lable">元/单位时间<span class="prompt">（无此服务填0）</span></span>
                </div>
                <div class="register-li">
                    <label class="register-label">&nbsp;</label>
                    <span class="register-input-lable">面对面咨询</span>
                    <input class="register-input register-input-price" type="text" name="f2fPriceN" id="f2fPriceN" value="" />
                    <span class="register-input-lable">元/单位时间<span class="prompt">（无此服务填0）</span></span>
                </div>
                <input class="three-submit" type="button" name="myInfoSubmit" id="myInfoSubmit" value="保存">
				</form>
            </div>
			<!--账户信息-->
			<div class="center-frame" id= "personInfo_1" style="display:none;">
            	<div class="center-info">
                	<div class="register-li">
                        <label class="register-label">手机号码:</label>
                        <span class="register-input-lable" id="phoneNum">138138XXXXX</span><span class="prompt">（次为账号不可修改）</span>
                    </div>
                </div>
            	<div class="center-info">
                	<div class="register-title">
                        <i></i>
                        <span>修改密码</span>
                    </div>
					<form id="updatePWDForm">
                    <div class="register-li">
                        <label class="register-label">当前密码:</label>
                        <input class="register-input" type="password" name="originPwd" id="originPwd" value="" />
                        <span class="register-input-lable"><span class="prompt">（默认手机号后六位）</span></span>
                    </div>
                    <div class="register-li">
                        <label class="register-label">新密码:</label>
                        <input class="register-input" type="password" name="expertPwd" id="expertPwd" value="" />
                    </div>
                    <div class="register-li">
                        <label class="register-label">确认新密码:</label>
                        <input class="register-input" type="password" name="expertPwd1" id="expertPwd1" value="" />
                    </div>
					<input class="three-submit" type="submit" name="updatePwd"  id="updatePwd"value="确认">
					</form>
                </div>
                <div class="center-info">
                	<div class="register-title">
                        <i></i>
                        <span>账户信息</span>
                    </div>
					<div id="accountList">
						<div class="register-li">
							<span class="center-info-img"><img src="images/admin/icon/zfb.png" alt="" /></span>
							<span class="center-info-title">支付宝</span>
							<span class="center-info-num"></span>
							<a class="center-info-but" href="javascript:;">绑定</a>
						</div>
						<div class="register-li">
							<span class="center-info-img"><img src="images/admin/icon/wx.png" alt="" /></span>
							<span class="center-info-title">微信支付</span>
							<span class="center-info-num"></span>
							<a class="center-info-but" href="javascript:;">绑定</a>
						</div>
						<!--<div class="register-li">-->
							<!--<span class="center-info-img"><img src="images/admin/icon/jsBank.png" alt="" /></span>-->
							<!--<span class="center-info-title">绑定银行</span>-->
							<!--<span class="center-info-num"></span>-->
							<!--<a class="center-info-but" href="javascript:;">解绑</a>-->
						<!--</div>-->
                        <div class="register-li">
                           <b style="width:20px;height:20px;float:left;background:url(images/admin/icon/add.png);background-size:100% 100%;margin-top:1px;margin-right:5px;"></b>
                            <a id="addCard" href="javascript:;">添加银行卡</a>
                        </div>
					</div>
                </div>
            </div>
			<!--资质认证-->
			<div class="center-frame" id= "personInfo_2" style="display:none;">
            	<div class="register-auth-top">身份证明</div>
            	<div class="register-li" style="margin-bottom:30px; padding-left:80px;">
                    <div class="register-file-content">
                        <span class="register-file-title font-bold">正面</span>
                        <span class="register-file-img"><img src="" alt="" id="IDPicF" /></span>
                        <div class="register-file-box">
                            <div class="register-file-val"></div>
                            <div class="register-file-but">浏览</div>
                            <input class="register-file" type="file" id="idPicF" name="idPicF" />
                        </div>
                        <div class="register-file-box">
                            <div class="register-file-frame">
                                <span>格式要求：jpg、png</span>
                                <span>尺寸要求：300*200px</span>
                            </div>
                            <a class="register-file-submit" onclick="javascript:uploadImg('idPicF',this);">上传</a>
                        </div>
                    </div>
                    <div class="register-file-content">
                        <span class="register-file-title font-bold">反面</span>
                        <span class="register-file-img"><img src="" alt="" id="IDPicB"/></span>
                        <div class="register-file-box">
                            <div class="register-file-val"></div>
                            <div class="register-file-but">浏览</div>
                            <input class="register-file" type="file" id="idPicB" name="idPicB"/>
                        </div>
                        <div class="register-file-box">
                            <div class="register-file-frame">
                                <span>格式要求：jpg、png</span>
                                <span>尺寸要求：300*200px</span>
                            </div>
                            <a class="register-file-submit" onclick="javascript:uploadImg('idPicB',this);">上传</a>
                        </div>
                    </div>
                    <div class="register-file-content">
                        <span class="register-file-title font-bold">资质证书</span>
                        <span class="register-file-img"><img src="" alt="" id="qualificationPic" /></span>
                        <div class="register-file-box">
                            <div class="register-file-val"></div>
                            <div class="register-file-but">浏览</div>
                            <input class="register-file" type="file" id="qualiPic" name="qualiPic"/>
                        </div>
                        <div class="register-file-box">
                            <div class="register-file-frame">
                                <span>格式要求：jpg、png</span>
                                <span>尺寸要求：400*600px</span>
                            </div>
                            <a class="register-file-submit" onclick="javascript:uploadImg('qualiPic',this);">上传</a>
                        </div>
                    </div>
                    <div class="register-file-content">
                        <span class="register-file-title font-bold">背景图<span class="icon"></span></span>
                        <span class="register-file-img"><img src="" alt="" id="backgroundPic"/></span>
                        <div class="register-file-box">
                            <div class="register-file-val"></div>
                            <div class="register-file-but">浏览</div>
                            <input class="register-file" type="file" id="backPic" name="backPic" />
                        </div>
                        <div class="register-file-box">
                            <div class="register-file-frame">
                                <span>格式要求：jpg、png</span>
                                <span>尺寸要求：400*600px</span>
                            </div>
                            <a class="register-file-submit" onclick="javascript:uploadImg('backPic',this);">上传</a>
                        </div>
                        <div class="register-file-icon">
                        	背景图将用在APP中的专家详情页，作为头像的背景。
                        </div>
                    </div>
                </div>    
            </div>       
			<!--详细情况-->           
			<div class="center-frame" id= "personInfo_3" style="display:none;">
                <div class="register-li" style="margin-bottom:30px; padding-left:80px;">
                    <div class="register-title register-title-left detail-title">
                        <i></i>
                        <span>擅长领域</span>
                        <span class="prompt">*</span>
                    </div>
                    <div class="register-li register-li-right">
                        <div class="register-li-column">
                            <label><input type="checkbox" name="expertise" id="expertise" value="1" /><span>情绪困扰</span></label>
                            <label><input type="checkbox" name="expertise" id="expertise" value="2" /><span>人际关系</span></label>
                            <label><input type="checkbox" name="expertise" id="expertise" value="3" /><span>婚恋问题</span></label>
                            <label><input type="checkbox" name="expertise" id="expertise" value="4" /><span>性心理</span></label>
                        </div>
                        <div class="register-li-column">
                            <label><input type="checkbox" name="expertise" id="expertise" value="5" /><span>职业规划</span></label>
                            <label><input type="checkbox" name="expertise" id="expertise" value="6" /><span>压力疏导</span></label>
                            <label><input type="checkbox" name="expertise" id="expertise" value="7" /><span>儿童教育</span></label>
                            <label><input type="checkbox" name="expertise" id="expertise" value="8" /><span>青少年心理</span></label>
                        </div>
                        <div class="register-li-column">
                            <label><input type="checkbox" name="expertise" id="expertise" value="9" /><span>自我成长</span></label>
                            <label><input type="checkbox" name="expertise" id="expertise" value="10" /><span>家庭关系</span></label>
                            <label><input type="checkbox" name="expertise" id="expertise" value="11" /><span>其他</span></label>
                        </div>
                    </div>
                </div> 
                <div class="register-li" style="margin-bottom:30px; padding-left:80px;">
                	<div class="register-title register-title-left detail-title">
                        <i></i>
                        <span>学历背景</span>
                        <span class="prompt">*</span>
                    </div>
                    <div class="register-li register-li-right">
                        <textarea class="register-li-textarea" name="background" id="background" ></textarea>
                    </div> 
                </div>
                <input class="detail-submit" type="submit" name="" id="savebackground" value="保存">
            </div>
    </div>
 </div>
    <div class="alertBox">
        <div class="bindBox">
            <h3 class="title">绑定支付宝帐号</h3>
            <ul>
                <li>
                    <span>支付宝帐号：</span><input type="text" placeholder="请输入支付宝帐号" id="zfbaccount">
                </li>
                <li>
                    <span>提现帐号：</span><input type="text" placeholder="请输入提现帐号" id="account">
                </li>
            </ul>
            <div class="bindFooter">
                <button class="confim">确认</button>
                <button class="cancel">取消</button>
            </div>
        </div>
    </div>
    <div class="window bank-add">
        <div class="window-bg"></div>
        <div class="window-frame clear">
            <div class="window-out">X</div>
            <div class="bank-add-frame">
                <div class="title">添加银行卡</div>
                <div class="bank-add-li">
                    <div class="frame">
                        <span class="label">持卡人：</span>
                        <input class="input" name="" value="" id="pname">
                    </div>
                    <span class="id-num">身份证：3202344534443333232</span>
                </div>
                <div class="bank-add-li">
                    <span class="text">请绑定持卡人的银行卡</span>
                </div>
                <div class="bank-add-li">
                    <div class="bank-add-box">
                        <div class="input-box">
                            <span class="label">银行：</span>
                            <select class="select" id="bankName">
                                <option value="中国银行">中国银行</option>
                                <option value="建设银行">建设银行</option>
                            </select>
                        </div>
                        <div class="input-box">
                            <span class="label">省份城市：</span>
                            <select class="select" name="" id="city">
                                <option value="">江苏省南京市</option>
                            </select>
                        </div>
                    </div>
                    <div class="bank-add-box">
                        <div class="input-box">
                            <span class="label">开户行：</span>
                            <input class="input" type="text" name="" value="" id="bankDetail">
                        </div>
                        <div class="input-box">
                            <span class="label">卡号：</span>
                            <input class="input" type="text" name="" value="" id="bankNo">
                        </div>
                    </div>
                    <div class="bank-add-but-box">
                        <span class="bank-add-but-out">取消</span>
                        <span class="bank-add-but-add" id="bankAddBtn">确认</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--页面绑定参数-->
    <input type="hidden" id="accountId" value="6">
 <!--<script src="js/centerA.js"></script>-->
<script>
	$(function(){
	    /*********个人照片*****/
		/*$.datepicker.regional['zh-CN'] = {
		closeText: '关闭',
		prevText: '<上月',
		nextText: '下月>',
		currentText: '今天',
		monthNames: ['一月','二月','三月','四月','五月','六月',
		'七月','八月','九月','十月','十一月','十二月'],
		monthNamesShort: ['一','二','三','四','五','六',
		'七','八','九','十','十一','十二'],
		dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
		dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
		dayNamesMin: ['日','一','二','三','四','五','六'],
		dateFormat: 'yy-mm-dd', firstDay: 1,
		isRTL: false};
		$.datepicker.setDefaults($.datepicker.regional['zh-CN']);*/
//		$("#birthDay").datepicker({ dateFormat: "yy-mm-dd"});
		jeDate({
			dateCell:"#birthDay",//isinitVal:true,
			format:"YYYY-MM-DD",
			isTime:false, //isClear:false,
			minDate:"1901-01-01 00:00:00"
		})
		/*	showAnim: 'slideDown',//show 默认,slideDown 滑下,fadeIn 淡入,blind 百叶窗,bounce 反弹,Clip 剪辑,drop 降落,fold 折叠,slide 滑动
			//minDate: -1,//最小日期，可以是Date对象，或者是数字（从今天算起，例如+7），或者有效的字符串('y'代表年, 'm'代表月, 'w'代表周, 'd'代表日, 例如：'+1m +7d')。
			//maxDate: +17,//最大日期，同上
			//defaultDate : +4, //默认日期，同上
			duration : 'fast',//动画展示的时间，可选是"slow", "normal", "fast",''代表立刻，数字代表毫秒数
			firstDay : 1 ,//设置一周中的第一天。默认星期天0，星期一为1，以此类推。
			nextText : '下一月',//设置“下个月”链接的显示文字。鼠标放上去的时候
			prevText : '上一月',//设置“上个月”链接的显示文字。
			showButtonPanel: true,//是否显示按钮面板 
			currentText : '今天',//设置当天按钮的文本内容，此按钮需要通过showButtonPanel参数的设置才显示。
			gotoCurrent : false,//如果设置为true，则点击当天按钮时，将移至当前已选中的日期，而不是今天。
		});  */
		//顶部按钮切换
		$("#center_info >a").click(function(){
			var i = $(this).index();
			$("#center_info >a").removeClass("active");
			$(".center-frame").css("display","none");
			$(this).addClass("active");
			$("#personInfo_"+i).css("display","block");
			}
		);
		var expertId = $.cookie("expertId");
		ajaxPostJson(requestUrl + "/expert/getMyInfoWithAccountA", function(data, status){
			eval("rt=" + data);
			for(var key in rt){
			//	console.log(key + ': ' + rt[key])
			}
			for(var key in rt.expert){
				//console.log(key+': '+rt.expert[key])
			}
        	if (rt.error!="") {
        		 alert(rt.error);
        		 window.location.href = 'loginA.html'
			}else{ 
				 var expert =  rt.expert;
				 var appendInfo = rt.appendInfo;
				 var accountList =rt.accountList;
				 //基本资料
				 $("#expertId").val(expert.expertId);
				 $("#realName").val(expert.realName);
				 $("#pname").val(expert.realName);
				 if(expert.gender==0){
					$("input[name='gender']").eq(0).attr("checked","checked");
					$("input[name='gender']").eq(1).removeAttr("checked");
					$("input[name='gender']").eq(0).click();
					
				 }else{
					$("input[name='gender']").eq(1).attr("checked","checked");
					$("input[name='gender']").eq(0).removeAttr("checked");
					$("input[name='gender']").eq(1).click();
				 }
				 //$("#birthDay").val(rt.birthDay);
				 //yu
				 rt.appendInfo && $("#birthDay").val(appendInfo.birthDay);
				 //end yu
				 $("#ID").val(expert.ID);
                $(".window  .id-num").html("身份证："+expert.ID);
				 if(typeof(appendInfo)!="undefined"){
					 $("#education").find("option[value='"+appendInfo.education+"']").attr("selected",true);
					 $("#marriage").find("option[value='"+appendInfo.marriage+"']").attr("selected",true);
				 }
				 new PCAS("province","city",expert.province,expert.city);
				 $("#position").find("option[value='"+expert.position+"']").attr("selected",true);
				 $("#qqNumber").val(expert.qqNumber);
				 $("#eMail").val(expert.eMail);
				 $("#portrait").attr("src",expert.portrait);
                $("#backgroundPic").attr("src",expert.backgroundPic);
                $("#qualificationPic").attr("src",expert.qualificationPic);
				 $("#slogan").val(expert.slogan);
				 $("#timeUnit").val(expert.timeUnit);
				 $("#callPriceN").val(expert.callPriceN);
				 $("#textPriceN").val(expert.textPriceN);
				 $("#f2fPriceN").val(expert.f2fPriceN);
				 //账户信息
				 $("#phoneNum").html(expert.expertPhoneNum);
				 if(rt.accountList!=null){
                     $.each(rt.accountList,function(i){
                         var account=rt.accountList[i]['accountType'];
                        var  payType="支付宝";
                         var list=rt.accountList[i];
					   if(account==1){
							payType=="支付宝";
                           $("#accountList>.register-li").eq(0).children('.center-info-num').attr('data-name',list.cardOwner);
                           $("#accountList>.register-li").eq(0).children('.center-info-num').html(list.account);
                           $("#accountList>.register-li").eq(0).children('.center-info-but').html('重新绑定');
					   }else if(account==2){
							payType=="微信支付";
                           $("#accountList>.register-li").eq(1).children('.center-info-num').attr('data-name',list.cardOwner);
                           $("#accountList>.register-li").eq(1).children('.center-info-num').html(list.account);
                           $("#accountList>.register-li").eq(1).children('.center-info-but').html('重新绑定');
					   }else{
							payType==account.bankName;
                           $("#accountList>.register-li").eq(2).children('.center-info-num').attr('data-name',list.cardOwner);
                           $("#accountList>.register-li").eq(2).children('.center-info-num').html(list.account);
                           $("#accountList>.register-li").eq(2).children('.center-info-but').html('解绑');
					   }
					 });
				}
//				添加银行卡
                $("#addCard").click(function(){
//                    $("#zfbaccount").val('');
//                    $('#account').val('');
//                    $(".alertBox .bindBox .title").html("帐户名");
//                    $(".alertBox .bindBox ul>li:first-child>span").html("支付帐号：");
//                    $(".alertBox .bindBox ul>li:first-child>input").attr("placeholder","请输入帐号").attr("class","bank");
//                    $(".alertBox").show();
                    $(".bank-add").fadeIn();
                });
				//资质认证	
			    $("#IDPicF").attr("src",expert.IDPicF);
				$("#IDPicB").attr("src",expert.IDPicB);
				$("#qualificationPic").attr("src",expert.qualificationPic);
				$("#backPic").attr("src",expert.backPic);
				//详细情况
				if(expert.expertise!=""){
					var expertise =expert.expertise.split(";");
					for(var i = 0;i < expertise.length; i++) { 
                        var expertises = $("input[type='checkbox'][name='expertise']");
                        for(i=0;i<expertises.length;i++){
                        for(j=0;j<expertise.length;j++){
                        if(expertises[i].value ==expertise[j]){
                                    expertises[i].checked = true;
                        break;
                        }
                      }
                    }
					}
				}
				$("#background").val(expert.background);
			}
        }, {"from":"expert","expertId":expertId,"debug":1});
//显示错误信息
        function getError(el,text){
            if($(el).val().trim()==''){
                alert(text);
                return false;
            }
            return true;
        }
//		更新专家信息
		$("#myInfoSubmit").click(function(){
		    if(!getError("#realName","姓名不能为空。。")){return false;}
		    if(!getError("#ID","身份证号不能为空。。")){return false;}
		    if(!getError("#province","目前所在地不能为空。。")){return false;}
		    if(!getError("#position","专业资质不能为空。。")){return false;}
		    if(!getError("#qqNumber","QQ不能为空。。")){return false;}
		    if(!getError("#eMail","邮箱地址不能为空。。")){return false;}
		    if(!getError("#slogan","个性签名不能为空。。")){return false;}
		    if(!getError("#timeUnit","服务时间不能为空。。")){return false;}
		    if(!getError("#callPriceN","语音咨询价格不能为空。。")){return false;}
		    if(!getError("#textPriceN","文字咨询价格不能为空。。")){return false;}
		    if(!getError("#f2fPriceN","面对面咨询价格不能为空。。")){return false;}
		    if(!getError("#background","学历背景不能为空。。")){return false;}
			var expertId = $.cookie("expertId");
			var formData = $("#form_personInfo").serialize();
            var expertises = $("input[type='checkbox'][name='expertise']");
            var expertiseStr ="";
            var checkedArr=[];
            for(i=0;i<expertises.length;i++){
                if(expertises[i].checked){
                    checkedArr.push(expertises[i].nextSibling.innerHTML);
                    expertiseStr+=(expertiseStr==""?"":";")+expertises[i].nextSibling.innerHTML;
                }
            }
            if(checkedArr.length<=0){
                alert("擅长领域必须选择");
                return false;
            }
			ajaxPostJson(requestUrl + "/expert/updateInfoA?"+formData+"&from=expert&expertId="+expertId+"&debug=1&expertise="+expertiseStr, function(data, status){
				eval("rt=" + data);
                if (rt.error!="") {
					 alter(rt.error);
				}else{ 
					alert('success');
                    ajaxPostJson(requestUrl + "/expert/updateAppendInfoA?"+formData+"&from=expert&expertId="+expertId+"&debug=1", function(data, status){
                        eval("rt=" + data);
                        if (rt.error!="") {
                            alter(rt.error);
                        }else{
                            window.location.reload();
                        }
                    });
				}
			});
		});

		//修改密码
		$("#updatePwd").click(function(event){
		    event.preventDefault();
			var expertId = $.cookie("expertId");
			var originPwd = $("#originPwd").val().trim();
			var expertPwd = $("#expertPwd").val().trim();
			var expertPwd1 = $("#expertPwd1").val().trim();
            if(originPwd){
                if(expertPwd!==""){
                    if(expertPwd==expertPwd1){
                        ajaxPostJson(requestUrl + "/expert/updatePwdA", function(data, status){
                            eval("rt=" + data);
                            if (rt.error!="") {
                                alert(rt.error);
                            }else{
                                alert("密码修改成功！");
                                $("#originPwd").val('');
                                $("#expertPwd").val('');
                                $("#expertPwd1").val('');
                            }
                        },{"from":"expert","expertId":expertId,"debug":1,"expertPwd":$.md5(expertPwd),"originPwd":$.md5(originPwd)});

                    }else{
                        alert("两次输入密码不一致");
                    }
                }else{
                    alert("新密码不能为空");
                }
            }else{
                alert("原密码不能为空");
            }
			});
		//
		$("#savebackground").click(function(){
            if($("#realName").val()==''){
                alert('姓名不能为空');
                return false;
            }
            if($("#ID").val()==''){
                alert('身份证号码不能为空');
                return false;
            }
            if($("#qqNumber").val()==''){
                alert('QQ不能为空');
                return false;
            }
            if($("#eMail").val()==''){
                alert('邮箱地址不能为空');
                return false;
            }
            if($("#slogan").val()==''){
                alert('个性签名不能为空');
                return false;
            }
            if($("#timeUnit").val()==''){
                alert('服务时间不能为空');
                return false;
            }
            if($("#background").val()==''){
                alert('学历背景不能为空');
                return false;
            }
			var expertId = $.cookie("expertId");
			var background = $("#background").val();
			var expertises = $("input[type='checkbox'][name='expertise']");
			var expertiseStr ="";
            var checkedArr=[];
			for(i=0;i<expertises.length;i++){
		    if(expertises[i].checked){
		            checkedArr.push(expertises[i].nextSibling.innerHTML);
                    expertiseStr+=(expertiseStr==""?"":";")+expertises[i].nextSibling.innerHTML;
		    }
		  }
            if(checkedArr.length<=0){
                alert("擅长领域必须选择");
                return false;
            }
			ajaxPostJson(requestUrl + "/expert/updateInfoA", function(data, status){
				eval("rt=" + data);
				if (rt.error!="") {
					 alert(rt.error);
				}else{
                    alert("保存成功！");
				}
			},{"from":"expert","expertId":expertId,"debug":1,"expertise":expertiseStr,"background":background});
		});

//        重新绑定按钮
        $(".center-info-but").each(function(){
            $(this).click(function(){
                var way=$(this).siblings(".center-info-title").html();
                console.log(way);
                $("#zfbaccount").val('');
                $('#account').val('');
                if(way=="支付宝"){
                    $("#zfbaccount").val($(this).siblings('.center-info-num').attr('data-name'));
                    $('#account').val( $(this).siblings('.center-info-num').html());
                    $(".alertBox .bindBox .title").html("绑定支付宝");
                    $(".alertBox .bindBox ul>li:first-child>span").html("支付帐号：");
                    $(".alertBox .bindBox ul>li:first-child>input").attr("placeholder","请输入帐号").attr("class","zfb");
                    $(".alertBox").fadeIn();
                }else if(way=="微信支付"){
                    $("#zfbaccount").val($(this).siblings('.center-info-num').attr('data-name'));
                    $('#account').val( $(this).siblings('.center-info-num').html());
                    $(".alertBox .bindBox .title").html("绑定微信");
                    $(".alertBox .bindBox ul>li:first-child>span").html("支付帐号：");
                    $(".alertBox .bindBox ul>li:first-child>input").attr("placeholder","请输入帐号").attr("class","wx");
                    $(".alertBox").fadeIn();
                }else{
                    $(".bank-add").fadeIn();
                }

            });
        });
//        获取绑定方式
        function getWay(state){
            if(state=="wx"){
                return "微信";
            }else if(state=="zfb"){
                return "支付宝";
            }else if(state=="bank"){
                return "银行";
            }
        }
//        绑定帐号按钮
        $(".bindFooter button").each(function(){
            $(this).click(function(){
                if($(this).hasClass("confim")){
                    var input=$(this).parent().siblings("ul").find("li:first-child").children("input");
                    var tx_account=$("#zfbaccount").val().trim();
                    var account=$("#account").val().trim();
                    var name=getWay(input.attr("class"));
                    if(tx_account!=""){
                        if(account!=""){
                            ajaxPostJson(requestUrl + "/eaccount/updateAccountX", function(data, status){
                                if(data.error!==""){
                                    eval("rt=" + data);
                                    alert(rt.error);
                                }
                            },{"from":"expert","expertId":expertId,"debug":1,"accountId":$("#accountId").val(),account:account,"cardOwner":tx_account})
                        }else{
                            alert("提现帐号不能为空");
                        }
                    }else{
                        alert(name+"帐号不能为空");
                    }
                    if(input.hasClass("wx")||input.hasClass("zfb")){

                    }
                }else{
                    $(".alertBox").fadeOut(200);
                }
            });
        });
	});
	/**上传图片*/
	function uploadImg(type,elm){
		var phoneNum = $("#phoneNum").html();
		$.ajaxFileUpload ({
			url :requestUrl + "/expert/updatePicA",
            data:{from:expert,expertPhoneNum:phoneNum},
			secureuri :false,
			fileElementId :type,
            type:"post",
			dataType : 'json',
			success : function (data, status){
				if(typeof(data.error) != 'undefined'){
					if(data.error != ''){
						alert(data.error);
					}else{
						alert(data.msg);
					}
				}
			},
			error: function (data, status, e){
                alert(123);
            }
		})
//		return false;
	}

//	预览图片
    function seeImg(el,imgBox){
        function getObjectURL(file) {
            var url = null;
            if (window.createObjectURL != undefined) { // basic
                url = window.createObjectURL(file);
            } else if (window.URL != undefined) { // mozilla(firefox)
                url = window.URL.createObjectURL(file);
            } else if (window.webkitURL != undefined) { // webkit or chrome
                url = window.webkitURL.createObjectURL(file);
            }
            return url;
        }
        el.on("change",function(){
            var objUrl = getObjectURL(el[0].files[0]) ;
            if (objUrl) {
                imgBox.attr("src", objUrl);
                imgBox.attr("class", "fileImg");
            }
        })
    }
    $(".register-file-but").each(function(i){
        this.index=i;
        var imgId=['portrait','IDPicF','IDPicB','qualificationPic','backgroundPic'];
        $(this).click(function(){
            var box=$(this).siblings("input").attr("id");
            $("#"+box).click();
            seeImg($("#"+box),$("#"+imgId[this.index]));
        });
    });
</script>
</body>
</html>
